package com.fusuhai05;

import com.fusuhai02.A;

class Dog extends Animal {
    @Override
    public void eat() {
        System.out.println("小狗喜欢啃骨头");
    }
}

class Feeder {
    public void feed(Animal animal) {

        animal.eat();
    }
}

class Cat extends Animal {
    @Override
    public void eat() {
        System.out.println("小猫爱吃鱼");
    }

    public void play() {
        System.out.println("小猫咪喜欢play");
    }
}

public class Animal {
    public void eat() {
        System.out.println("动物喜欢吃东西");
    }

    public void play() {
        System.out.println("动物喜欢play");
    }


    public static void main(String[] args) {
        Animal a1 = new Animal();
        Animal a2 = new Cat();
        a2.eat();
        a2.play();

        Animal a3 = new Dog();
        System.out.println("---------------------");
        Feeder feeder = new Feeder();
        feeder.feed(a2);
        feeder.feed(a3);
    }


}
